/**
 * @Author: zkz
 * @Date: 2025/10/10 16:04
 * @Description: 封装频道列表hook的逻辑功能111
 */
import { useState, useEffect } from 'react';
import { getChannelAPI } from '@/api/article';
function useChannel() {
    // 1.获取频道列表的所有逻辑
    const [channelList, setChannelList] = useState([]);
    useEffect(() => {
        const getChannelList = async () => {
            const res = await getChannelAPI();
            setChannelList(res.data.channels);
        };
        getChannelList();
    }, []);
    //2.把组件的要用的数据return出去
    return {
        channelList
    }
}

export default useChannel;